{template "header.html"}
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache();">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>
<script type="application/javascript">

</script>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green-sharp">
                    {dr_lang('接口密钥')}
                </span>
            </div>
            <div class="actions">
                <div class="btn-group">
                    <a class="btn" href="{$reply_url}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回')}</a>
                </div>
            </div>
        </div>
        <div class="portlet-body">
            <div class="form-body">


                {$myfield}

                {if $id}
                <div class="form-group">
                    <label class="col-md-2 control-label">AppId</label>
                    <div class="col-md-9">
                        <div class="form-control-static"><label>{$id}</label></div>
                    </div>
                </div>
                {/if}

                <div class="form-group">
                    <label class="col-md-2 control-label">AppSecret</label>
                    <div class="col-md-9">
                        <label><input class="form-control input-large" type="text" name="data[secret]" id="sys_key" value="{$secret}"  ></label>
                        <label><button class="btn btn-sm blue" type="button" name="button" onclick="dr_to_key()"> {dr_lang('随机生成')} </button></label>
                        <span class="help-block">{dr_lang('密钥是认证接口的关键凭证请勿泄漏')}</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">{dr_lang('接口状态')}</label>
                    <div class="col-md-9">
                        <div class="mt-radio-inline">
                            <label class="mt-radio">
                                <input  {if !$disabled}checked{/if} name="data[disabled]" type="radio" value="0"> {dr_lang('正常')}
                                <span></span>
                            </label>
                            <label class="mt-radio">
                                <input  {if $disabled}checked{/if} name="data[disabled]" type="radio" value="1"> {dr_lang('禁用')}
                                <span></span>
                            </label>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button>
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000', '{$post_url}')" class="btn blue"> <i class="fa fa-plus"></i> {dr_lang('保存再添加')}</button>
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000', '{$reply_url}')" class="btn yellow"> <i class="fa fa-mail-reply-all"></i> {dr_lang('保存并返回')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    function dr_to_key() {
        $.get("{dr_url('api/syskey')}", function(data){
            $("#sys_key").val(data);
        });
    }
</script>
{template "footer.html"}